package org.monkey.example.websocket.config;

import lombok.extern.slf4j.Slf4j;
import org.monkey.example.websocket.handler.MsgEventHandler;
import org.monkey.socket.plugin.service.IMsgDealAction;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class SocketMsgConfigBean implements InitializingBean {
  @Autowired
  MsgEventHandler msgEventHandler;
  @Autowired(required = false)
  IMsgDealAction msgDealAction;
  @Override
  public void afterPropertiesSet(){
    if (msgDealAction != null) {
      msgDealAction.addSendHandler(msgEventHandler);
    }
  }
}
